# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -o - %s | FileCheck %s
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=legalizer -o - %s | FileCheck %s

---
name: test_zextload_private_i32_i8
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_zextload_private_i32_i8
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
    ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p5) :: (load (s8), addrspace 5)
    ; CHECK-NEXT: $vgpr0 = COPY [[ZEXTLOAD]](s32)
    %0:_(p5) = COPY $vgpr0
    %1:_(s32) = G_ZEXTLOAD %0 :: (load (s8), addrspace 5)
    $vgpr0 = COPY %1
...
---
name: test_zextload_private_i32_i16
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_zextload_private_i32_i16
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
    ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p5) :: (load (s16), addrspace 5)
    ; CHECK-NEXT: $vgpr0 = COPY [[ZEXTLOAD]](s32)
    %0:_(p5) = COPY $vgpr0
    %1:_(s32) = G_ZEXTLOAD %0 :: (load (s16), addrspace 5)
    $vgpr0 = COPY %1
...
---
name: test_zextload_private_i31_i8
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_zextload_private_i31_i8
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
    ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p5) :: (load (s8), addrspace 5)
    ; CHECK-NEXT: $vgpr0 = COPY [[ZEXTLOAD]](s32)
    %0:_(p5) = COPY $vgpr0
    %1:_(s31) = G_ZEXTLOAD %0 :: (load (s8), addrspace 5)
    %2:_(s32) = G_ANYEXT %1
    $vgpr0 = COPY %2
...
---
name: test_zextload_private_i64_i8
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_zextload_private_i64_i8
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
    ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p5) :: (load (s8), addrspace 5)
    ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ZEXTLOAD]](s32)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
    %0:_(p5) = COPY $vgpr0
    %1:_(s64) = G_ZEXTLOAD %0 :: (load (s8), addrspace 5)
    $vgpr0_vgpr1 = COPY %1
...
---
name: test_zextload_private_i64_i16
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_zextload_private_i64_i16
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
    ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p5) :: (load (s16), addrspace 5)
    ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ZEXTLOAD]](s32)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
    %0:_(p5) = COPY $vgpr0
    %1:_(s64) = G_ZEXTLOAD %0 :: (load (s16), addrspace 5)
    $vgpr0_vgpr1 = COPY %1
...
---
name: test_zextload_private_i64_i32
body: |
  bb.0:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_zextload_private_i64_i32
    ; CHECK: liveins: $vgpr0_vgpr1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
    ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p5) :: (load (s32), addrspace 5)
    ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[LOAD]](s32)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
    %0:_(p5) = COPY $vgpr0
    %1:_(s64) = G_ZEXTLOAD %0 :: (load (s32), addrspace 5)
    $vgpr0_vgpr1 = COPY %1
...
